// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   BAG_PNImpl.java

package com.sunwayhorizo.health.hl7.datatypes.common;

import com.sunwayhorizo.health.hl7.common.VersionInfo;
import com.sunwayhorizo.health.hl7.datatypes.ANY;
import com.sunwayhorizo.health.hl7.datatypes.BAG_PN;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.INT;
import com.sunwayhorizo.health.hl7.datatypes.PN;
import com.sunwayhorizo.health.hl7.datatypes.TYPE;

import java.util.List;


// Referenced classes of package oracle.apps.ctb.hl7.types.common:
//            BAGCommonImpl, ANYImpl, CSImpl, NullFlavorImpl, 
//            TYPEImpl

public class BAG_PNImpl extends BAGCommonImpl
    implements BAG_PN
{

    public static final String RCS_ID = "$Header: BAG_PNImpl.java 115.18 2005/09/16 09:23:34 amchanda noship $";
    public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header: BAG_PNImpl.java 115.18 2005/09/16 09:23:34 amchanda noship $", "oracle.apps.ctb.hl7.types.common");
    private static final BAG_PN nullNI = new BAG_PNImpl(CSImpl.valueOf("NI"));
    private static final BAG_PN nullOTH = new BAG_PNImpl(CSImpl.valueOf("OTH"));
    private static final BAG_PN nullNINF = new BAG_PNImpl(CSImpl.valueOf("NINF"));
    private static final BAG_PN nullPINF = new BAG_PNImpl(CSImpl.valueOf("PINF"));
    private static final BAG_PN nullUNK = new BAG_PNImpl(CSImpl.valueOf("UNK"));
    private static final BAG_PN nullASKU = new BAG_PNImpl(CSImpl.valueOf("ASKU"));
    private static final BAG_PN nullNAV = new BAG_PNImpl(CSImpl.valueOf("NAV"));
    private static final BAG_PN nullMSK = new BAG_PNImpl(CSImpl.valueOf("MSK"));
    private static final BAG_PN nullNA = new BAG_PNImpl(CSImpl.valueOf("NA"));
    private static final BAG_PN nullNASK = new BAG_PNImpl(CSImpl.valueOf("NASK"));

    public static BAG_PN valueOf(List list)
    {
        if(list == null)
            throw ANYImpl.newNullException("BAG<PN>", "valueOf", "list");
        else
            return new BAG_PNImpl(list);
    }

    protected BAG_PNImpl(List list)
    {
        super(list);
    }

    protected BAG_PNImpl(CS cs)
    {
        super(cs);
    }

    public INT contains(PN pn)
    {
        return containsANY(pn);
    }

    public BAG_PN plus(BAG_PN bag_pn)
    {
        if(isNull().isTrue())
            return nullBAG_PN(NullFlavorImpl.NI);
        else
            return new BAG_PNImpl(plus(mList, bag_pn.toList()));
    }

    public BAG_PN minus(BAG_PN bag_pn)
    {
        if(isNull().isTrue())
            return nullBAG_PN(NullFlavorImpl.NI);
        else
            return new BAG_PNImpl(minus(mList, bag_pn.toList()));
    }

    public BAG_PN promotion(PN pn)
    {
        return new BAG_PNImpl(promoteItem(pn));
    }

    public TYPE dataType()
    {
        return com.sunwayhorizo.health.hl7.datatypes.common.TYPEImpl.BAG_PN;
    }

    public BL equal(ANY any)
    {
        throw ANYImpl.newUnsupportedException("BAG<PN>", "equal");
    }

    public int hashCode()
    {
        int i = 17;
        if(isNull().isFalse())
            i += mList.hashCode();
        return i;
    }

    protected boolean verifyItem(Object obj)
    {
        return obj instanceof PN;
    }

    public static BAG_PN nullBAG_PN(CS cs)
    {
        String s = null;
        if(cs == null || cs.literal().stringValue() == null || cs.isNull().isTrue())
            s = "NI";
        else
            s = cs.literal().stringValue();
        if(s.equals("NI"))
            return nullNI;
        if(s.equals("OTH"))
            return nullOTH;
        if(s.equals("NINF"))
            return nullNINF;
        if(s.equals("PINF"))
            return nullPINF;
        if(s.equals("UNK"))
            return nullUNK;
        if(s.equals("ASKU"))
            return nullASKU;
        if(s.equals("NAV"))
            return nullNAV;
        if(s.equals("MSK"))
            return nullMSK;
        if(s.equals("NA"))
            return nullNA;
        if(s.equals("NASK"))
            return nullNASK;
        else
            return nullNI;
    }

}
